#include(${wxWidgets_USE_FILE})
#include_directories( ${wxWidgets_INCLUDE_DIRS} )

#target_link_libraries(huniplacer_3d ${wxWidgets_LIBRARIES})


#target_link_libraries(huniplacer_3d modbus)
#target_link_libraries(huniplacer_3d GL)
#target_link_libraries(huniplacer_3d glut)
#target_link_libraries(huniplacer_3d GLU)


##############################################################
# CMakeLists.txt for a ROS package within the low-cost-vision
# build system. 
# 
# Created by Pascal Muller <pascalmuller@gmail.com>, 09-02-2012
# 
# 09-02-2012 Initial version
# 
#############################################################

cmake_minimum_required(VERSION 2.4.6)
# Include all rosbuild macros
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

# Include FindPkgConfig.cmake, this allows for dependency checking using pkg-config
include(FindPkgConfig)
pkg_check_modules(PKG_LIBS_ROS_CRATE_VISION opencv)
find_package(Unicap)

# Only add the target to the generated makefile if all external library dependencies 
# are satisfied. 
if(PKG_LIBS_ROS_CRATE_VISION_FOUND) # WARNING! DON'T REUSE the PKG_LIBS_ROS_CRATE_VISION_* variables 
	# Initialize ROS package to be in our build system. 
	lcv_rospack_init("crate_vision" true false)

	# Add executables as documented by ROS
	rosbuild_add_executable(crate_vision src/main.cpp src/CrateVisionNode.cpp src/Detect.cpp src/Initialize.cpp)

	# Add dependencies to our libraries and other ROS packages in the same directory as this one. 
	add_dependencies(crate_vision Fiducial xml_io)

	# Link target to external libraries
	target_link_libraries(crate_vision boost_thread)
	target_link_libraries(crate_vision boost_system)
	target_link_libraries(crate_vision tinyxml)

	# Include and link to libraries found by pkg_check_modules()
	include_directories(${PKG_LIBS_ROS_CRATE_VISION_INCLUDE_DIRS})
	target_link_libraries(crate_vision ${PKG_LIBS_ROS_CRATE_VISION_LIBRARIES} unicap) #TODO fix temporary hack
	#message(FATAL_ERROR ${UNICAP_LIBRARIES})
	
	include_directories("../huniplacer_3d/srv_gen/cpp/include/")

	# Include our libraries, they are all exported in Libraries/LibrariesExport.cmake
	#include_directories("${LIB_HUNIPLACER_INCLUDE}")
	include_directories("${LIB_FIDUCIAL_INCLUDE}")
	include_directories("${LIB_DATATYPES_INCLUDE}")
	include_directories("${LIB_PCRCTRANSFORMATION_INCLUDE}")
	include_directories("${LIB_UNICAPCVBRIDGE_INCLUDE}")
	include_directories("${UNICAP_INCLUDE_DIRS}")
	include_directories("${LIB_CAMERACALIBRATION_INCLUDE}")
	include_directories("${LIB_XMLIO_INCLUDE}")


	#include_directories("../vision/include/")

	# Link target to our libraries
	target_link_libraries(crate_vision Fiducial unicap_cv_bridge coordinates CameraCalibration xml_io)
	
	# MUST be called after lcv_rospack_init to clean up after ROSBUILD!
	lcv_rospack_end()

# Oh, let's just warn we omitted an target. 
else(PKG_LIBS_ROS_CRATE_VISION_FOUND)
	lcv_cannot_build(crate_vision, "ROS/crate_vision")
endif(PKG_LIBS_ROS_CRATE_VISION_FOUND)

